<template>
	<div class="main">
		<!--<div class="header_title">填写注册信息</div>-->
		<div  class="register-form">
            <van-field v-model="form.Password" type="password" label="原密码" placeholder="请输入原密码" />
            <!-- 输入密码 -->
            <van-field v-model="form.NewPassword" type="password" label="新密码" placeholder="请输入新密码" />
            <van-field v-model="form.ConfirmPassword" type="password" label="确认密码" placeholder="请确认密码" />
            <div style="margin: 20px">
                <van-button block type="info" @click="onSubmit">提交</van-button>
            </div>
        </div>

    </div>
</template>

<script>
import { Toast, Form } from 'vant'

var wait = 60
export default {
  components: {},
  data() {
    return {

      form: {

        Password: '',
        NewPassword: '',
        ConfirmPassword: '',
      },

    }
  },
  methods: {
    // 表单提交
    onSubmit() {
      if (!this.form.Password) {
        this.$toast('请输入原密码')
        return
      }
      if (!this.form.NewPassword) {
        this.$toast('请输入新密码')
        return
      }
      if (!this.form.ConfirmPassword) {
        this.$toast('请确认新密码')
        return
      }
      if (this.form.NewPassword !== this.form.ConfirmPassword) {
        this.$toast('两次密码输入不一致')
        return
      }

  		this.$axios
				.post('/UserUser/ChangePassword', this.form)
				.then((res) => {
					if (!res.success) return Toast.fail(res.errorText)
					Toast.success('修改成功')
					setTimeout(() => {
						this.$router.go(-2)
					}, 1500)
				})
				.catch((err) => {
					console.log('失败')
				})
    },
  },
}
</script>

<style lang="less" scoped>
.register-form {
}
.phone {
	position: relative;
	.code {
		position: absolute;
		right: 20px;
		top: 20px;
		font-size: 12px;
	}
}
</style>

